package com.hzhr.iot.device.service;

import com.hzhr.iot.core.annotation.ApiImplicitInternalParams;
import com.hzhr.iot.core.exception.ServiceException;
import com.hzhr.iot.core.util.HzhrDateUtil;
import com.hzhr.iot.core.util.HzhrTypeUtil;
import com.hzhr.iot.device.constant.Device_ErrorsEnum;
import com.hzhr.iot.device.dao.mapper.custom.PcRegulatorDeviceMonitorCollectDataMapper;
import com.hzhr.iot.device.entity.CollectDeviceEntity;
import com.hzhr.iot.device.entity.IotDeviceEntity;
import com.hzhr.iot.device.entity.RegulatorCollectDataEntity;
import com.hzhr.iot.device.entity.ext.RegulatorCollectDataEntityExt;
import com.hzhr.iot.device.model.regulatorDevice_monitor_collectData.RegulatorDevice_Monitor_CollectDataGetModel;
import com.hzhr.iot.device.model.regulatorDevice_monitor_collectData.RegulatorDevice_Monitor_CollectDataModel;
import com.hzhr.iot.device.service.base.BaseService;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;

@Service
public class RegulatorDevice_Monitor_CollectDataService extends BaseService {

    @Autowired
    PcRegulatorDeviceMonitorCollectDataMapper pcRegulatorDeviceMonitorCollectDataMapper;

    //region javadoc注释 : get
    /**
     * 查询调压设备下的监控设备 <br/><br/>
     * 步骤 : <br/>
     * 1. 查询调压设备 : <br/>
     * 查询COLLECT_DEVICE对象regulator_1， <br/>
     * 查询规则如下： <br/>
     *           (1) COLLECT_DEVICE.ID == 路径参数regulatorDeviceId; <br/>
     *           (2) COLLECT_DEVICE.IS_VALID == '1'； <br/>
     * 如果regulator_1不存在，抛出异常201； <br/>
     * 2. 查询调压设备的下的监控设备 : <br/>
     * 查询IOT_DEVICE对象monitor_1, <br/>
     * 查询规则如下： <br/>
     *           (1) IOT_DEVICE.COLLECT_DEVICE_ID == regulator_1.ID; <br/>
     *           (2) IOT_DEVICE.ID = 路径参数monitorId; <br/>
     *           (3) IOT_DEVICE.IS_VALID == '1'; <br/>
     * 3. 查询监控设备的采集数据(根据采集时间降序排列) <br/>
     * 查询REGULATOR_COLLECT_DATA对象集合collectDatas_1及总数， <br/>
     * 查询规则如下： <br/>
     *           (1) 条件参数的筛选条件; <br/>
     *           (2) COLLECT_DATA.IOT_DEVICE_ID = monitor_1.ID; <br/>
     *           (3) COLLECT_DATA.IS_VALID = '1'; <br/>
     * 3. 返回信息 <br/>
     * 根据条件参数、collectDatas_1及总数生成RegulatorDevice_Monitor_CollectDataGetModel对象result并返回， <br/>
     * RegulatorDevice_Monitor_CollectDataModel与REGULATOR_COLLECT_DATA的对应关系如下： <br/>
     *           (1) RegulatorDevice_Monitor_CollectDataModel.inPressure => REGULATOR_COLLECT_DATA.IN_PRESSURE; <br/>
     *           (2) RegulatorDevice_Monitor_CollectDataModel.envTemperature => REGULATOR_COLLECT_DATA.ENV_TEMPERATURE; <br/>
     *           (3) RegulatorDevice_Monitor_CollectDataModel.outPressure1 => REGULATOR_COLLECT_DATA.OUT_PRESSURE1; <br/>
     *           (4) RegulatorDevice_Monitor_CollectDataModel.outPressure2 => REGULATOR_COLLECT_DATA.OUT_PRESSURE2; <br/>
     *           (5) RegulatorDevice_Monitor_CollectDataModel.outPressure3 => REGULATOR_COLLECT_DATA.OUT_PRESSURE3; <br/>
     *           (6) RegulatorDevice_Monitor_CollectDataModel.outPressure4 => REGULATOR_COLLECT_DATA.OUT_PRESSURE4; <br/>
     *           (7) RegulatorDevice_Monitor_CollectDataModel.outTemperature1 => REGULATOR_COLLECT_DATA.OUT_TEMPERATURE1; <br/>
     *           (8) RegulatorDevice_Monitor_CollectDataModel.outTemperature2 => REGULATOR_COLLECT_DATA.OUT_TEMPERATURE2; <br/>
     *           (9) RegulatorDevice_Monitor_CollectDataModel.outTemperature3 => REGULATOR_COLLECT_DATA.OUT_TEMPERATURE3; <br/>
     *           (10) RegulatorDevice_Monitor_CollectDataModel.outTemperature4 => REGULATOR_COLLECT_DATA.OUT_TEMPERATURE4; <br/>
     *           (11) RegulatorDevice_Monitor_CollectDataModel.outStaTotalFlow1 => REGULATOR_COLLECT_DATA.OUT_STA_TOTAL_FLOW1; <br/>
     *           (12) RegulatorDevice_Monitor_CollectDataModel.outStaTotalFlow2 => REGULATOR_COLLECT_DATA.OUT_STA_TOTAL_FLOW2; <br/>
     *           (13) RegulatorDevice_Monitor_CollectDataModel.outStaTotalFlow3 => REGULATOR_COLLECT_DATA.OUT_STA_TOTAL_FLOW3; <br/>
     *           (14) RegulatorDevice_Monitor_CollectDataModel.outStaTotalFlow4 => REGULATOR_COLLECT_DATA.OUT_STA_TOTAL_FLOW4; <br/>
     *           (15) RegulatorDevice_Monitor_CollectDataModel.outStaFlowRate1 => REGULATOR_COLLECT_DATA.OUT_STA_FLOW_RATE1; <br/>
     *           (16) RegulatorDevice_Monitor_CollectDataModel.outStaFlowRate2 => REGULATOR_COLLECT_DATA.OUT_STA_FLOW_RATE2; <br/>
     *           (17) RegulatorDevice_Monitor_CollectDataModel.outStaFlowRate3 => REGULATOR_COLLECT_DATA.OUT_STA_FLOW_RATE3; <br/>
     *           (18) RegulatorDevice_Monitor_CollectDataModel.outStaFlowRate4 => REGULATOR_COLLECT_DATA.OUT_STA_FLOW_RATE4; <br/>
     *           (19) RegulatorDevice_Monitor_CollectDataModel.collectTime => REGULATOR_COLLECT_DATA.COLLECT_TIME; <br/>
     * @param header <br/>
     * _token : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 令牌;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : true;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : string;<br/>
     * _hzhr-user-id : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 用户编号;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : true;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : int;<br/>
     * _hzhr-user-code : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 用户代码;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : true;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : string;<br/>
     * _hzhr-user-name : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 用户名;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : true;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : string;<br/>
     * _hzhr-company-id : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 公司编号;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : true;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : int;<br/>
     * _hzhr-dept-id : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 部门编号;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : true;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : int;<br/>
     * _hzhr-user-type : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 用户类型(关联: common_service.options.code, typeCode = 'USER_TYPE');<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : true;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : string;<br/>
     * _hzhr-transaction-id : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 交易流水号;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : true;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : string;<br/>
     * _hzhr-transaction-type : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 交易类型;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : true;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : string;<br/>
     * _hzhr-access-mode : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 访问模式 0:一般 1:全局;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : false;<br/>&nbsp&nbsp&nbsp&nbsp 默认值 : 0;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : int;<br/><br/>
     * @param query <br/>
     * _show : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 展示形式 one:展示一个,list:展示列表,null(空值):不展示;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : false;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : string;<br/>
     * _show_total : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 是否展示总数;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : false;<br/>&nbsp&nbsp&nbsp&nbsp 默认值 : false;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : boolean;<br/>
     * _page : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 页数;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : false;<br/>&nbsp&nbsp&nbsp&nbsp 默认值 : 1;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : int;<br/>
     * _count : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 每页数量;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : false;<br/>&nbsp&nbsp&nbsp&nbsp 默认值 : 1;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : int;<br/>
     * _greaterthanorequal_collectTime : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 筛选条件 : where REGULATOR_COLLECT_DATA.COLLECT_TIME >= #{_greaterthanorequal_collectTime};<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : false;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : long;<br/>
     * _lessthan_collectTime : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 筛选条件 : where REGULATOR_COLLECT_DATA.COLLECT_TIME < #{_lessthan_collectTime};<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : false;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : long;<br/><br/>
     * @param regulatorDeviceId 调压设备编号 <br/><br/>
     * @param monitorId 监控设备编号 <br/><br/>
     * @throws ServiceException <br/>
     * @see RegulatorDevice_Monitor_CollectDataGetModel result <br/>
     */ 
    //endregion
    //region 说明 : get
    //查询调压设备下的监控设备
    //步骤 :
    //1. 查询调压设备 :
    //查询COLLECT_DEVICE对象regulator_1，
    //查询规则如下：
    //          (1) COLLECT_DEVICE.ID == 路径参数regulatorDeviceId;
    //          (2) COLLECT_DEVICE.IS_VALID == '1'；
    //如果regulator_1不存在，抛出异常201；
    //2. 查询调压设备的下的监控设备 :
    //查询IOT_DEVICE对象monitor_1,
    //查询规则如下：
    //          (1) IOT_DEVICE.COLLECT_DEVICE_ID == regulator_1.ID;
    //          (2) IOT_DEVICE.ID = 路径参数monitorId;
    //          (3) IOT_DEVICE.IS_VALID == '1';
    //3. 查询监控设备的采集数据(根据采集时间降序排列)
    //查询REGULATOR_COLLECT_DATA对象集合collectDatas_1及总数，
    //查询规则如下：
    //          (1) 条件参数的筛选条件;
    //          (2) COLLECT_DATA.IOT_DEVICE_ID = monitor_1.ID;
    //          (3) COLLECT_DATA.IS_VALID = '1';
    //3. 返回信息
    //根据条件参数、collectDatas_1及总数生成RegulatorDevice_Monitor_CollectDataGetModel对象result并返回，
    //RegulatorDevice_Monitor_CollectDataModel与REGULATOR_COLLECT_DATA的对应关系如下：
    //          (1) RegulatorDevice_Monitor_CollectDataModel.inPressure => REGULATOR_COLLECT_DATA.IN_PRESSURE;
    //          (2) RegulatorDevice_Monitor_CollectDataModel.envTemperature => REGULATOR_COLLECT_DATA.ENV_TEMPERATURE;
    //          (3) RegulatorDevice_Monitor_CollectDataModel.outPressure1 => REGULATOR_COLLECT_DATA.OUT_PRESSURE1;
    //          (4) RegulatorDevice_Monitor_CollectDataModel.outPressure2 => REGULATOR_COLLECT_DATA.OUT_PRESSURE2;
    //          (5) RegulatorDevice_Monitor_CollectDataModel.outPressure3 => REGULATOR_COLLECT_DATA.OUT_PRESSURE3;
    //          (6) RegulatorDevice_Monitor_CollectDataModel.outPressure4 => REGULATOR_COLLECT_DATA.OUT_PRESSURE4;
    //          (7) RegulatorDevice_Monitor_CollectDataModel.outTemperature1 => REGULATOR_COLLECT_DATA.OUT_TEMPERATURE1;
    //          (8) RegulatorDevice_Monitor_CollectDataModel.outTemperature2 => REGULATOR_COLLECT_DATA.OUT_TEMPERATURE2;
    //          (9) RegulatorDevice_Monitor_CollectDataModel.outTemperature3 => REGULATOR_COLLECT_DATA.OUT_TEMPERATURE3;
    //          (10) RegulatorDevice_Monitor_CollectDataModel.outTemperature4 => REGULATOR_COLLECT_DATA.OUT_TEMPERATURE4;
    //          (11) RegulatorDevice_Monitor_CollectDataModel.outStaTotalFlow1 => REGULATOR_COLLECT_DATA.OUT_STA_TOTAL_FLOW1;
    //          (12) RegulatorDevice_Monitor_CollectDataModel.outStaTotalFlow2 => REGULATOR_COLLECT_DATA.OUT_STA_TOTAL_FLOW2;
    //          (13) RegulatorDevice_Monitor_CollectDataModel.outStaTotalFlow3 => REGULATOR_COLLECT_DATA.OUT_STA_TOTAL_FLOW3;
    //          (14) RegulatorDevice_Monitor_CollectDataModel.outStaTotalFlow4 => REGULATOR_COLLECT_DATA.OUT_STA_TOTAL_FLOW4;
    //          (15) RegulatorDevice_Monitor_CollectDataModel.outStaFlowRate1 => REGULATOR_COLLECT_DATA.OUT_STA_FLOW_RATE1;
    //          (16) RegulatorDevice_Monitor_CollectDataModel.outStaFlowRate2 => REGULATOR_COLLECT_DATA.OUT_STA_FLOW_RATE2;
    //          (17) RegulatorDevice_Monitor_CollectDataModel.outStaFlowRate3 => REGULATOR_COLLECT_DATA.OUT_STA_FLOW_RATE3;
    //          (18) RegulatorDevice_Monitor_CollectDataModel.outStaFlowRate4 => REGULATOR_COLLECT_DATA.OUT_STA_FLOW_RATE4;
    //          (19) RegulatorDevice_Monitor_CollectDataModel.collectTime => REGULATOR_COLLECT_DATA.COLLECT_TIME;
    //endregion
    //region 参数 : get
    @ApiImplicitParams({
            @ApiImplicitParam(name = "token", value = "令牌",required = true, dataType = "string", paramType = "header"),

            @ApiImplicitParam(name = "regulatorDeviceId", value = "调压设备编号",required = true, dataType = "int", paramType = "path"),
            @ApiImplicitParam(name = "monitorId", value = "监控设备编号",required = true, dataType = "int", paramType = "path"),

            @ApiImplicitParam(name = "show", value = "展示形式 one:展示一个,list:展示列表,null(空值):不展示", required = false, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "show_total", value = "是否展示总数", defaultValue = "false", required = false, dataType = "boolean", paramType = "query"),
            @ApiImplicitParam(name = "page", value = "页数", defaultValue = "1",required = false, dataType = "int", paramType = "query"),
            @ApiImplicitParam(name = "count", value = "每页数量", defaultValue = "1",required = false, dataType = "int", paramType = "query"),
            @ApiImplicitParam(name = "greaterthanorequal_collectTime", value = "筛选条件 : where RegulatorDevice_Monitor_CollectDataModel.collectTime >= #{greaterthanorequal_collectTime}", required = false, dataType = "int", paramType = "query"),
            @ApiImplicitParam(name = "lessthan_collectTime", value = "筛选条件 : where RegulatorDevice_Monitor_CollectDataModel.collectTime < #{lessthan_collectTime}", required = false, dataType = "int", paramType = "query"),

    })
    @ApiImplicitInternalParams({
            @ApiImplicitParam(name = "_token", value = "令牌",required = true, dataType = "string", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-user-id", value = "用户编号",required = true, dataType = "int", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-user-code", value = "用户代码",required = true, dataType = "string", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-user-name", value = "用户名",required = true, dataType = "string", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-company-id", value = "公司编号",required = true, dataType = "int", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-dept-id", value = "部门编号",required = true, dataType = "int", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-user-type", value = "用户类型(关联: common_service.options.code, typeCode = 'USER_TYPE')",required = true, dataType = "string", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-transaction-id", value = "交易流水号",required = true, dataType = "string", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-transaction-type", value = "交易类型",required = true, dataType = "string", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-access-mode", value = "访问模式 0:一般 1:全局",defaultValue = "0", required = false, dataType = "int", paramType = "header"),

            @ApiImplicitParam(name = "_show", value = "展示形式 one:展示一个,list:展示列表,null(空值):不展示", required = false, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "_show_total", value = "是否展示总数", defaultValue = "false", required = false, dataType = "boolean", paramType = "query"),
            @ApiImplicitParam(name = "_page", value = "页数", defaultValue = "1",required = false, dataType = "int", paramType = "query"),
            @ApiImplicitParam(name = "_count", value = "每页数量", defaultValue = "1",required = false, dataType = "int", paramType = "query"),
            @ApiImplicitParam(name = "_greaterthanorequal_collectTime", value = "筛选条件 : where REGULATOR_COLLECT_DATA.COLLECT_TIME >= #{_greaterthanorequal_collectTime}", required = false, dataType = "long", paramType = "query"),
            @ApiImplicitParam(name = "_lessthan_collectTime", value = "筛选条件 : where REGULATOR_COLLECT_DATA.COLLECT_TIME < #{_lessthan_collectTime}", required = false, dataType = "long", paramType = "query"),

    })
    //endregion
    //region 请求 : get
    @RequestMapping(value = "/regulator-devices/{regulatorDeviceId}/monitors/{monitorId}/collect-datas", method = RequestMethod.GET)
    //endregion
    public RegulatorDevice_Monitor_CollectDataGetModel get(Map<String, String> header, Integer regulatorDeviceId,
                                                           Integer monitorId, Map<String, Object> query) throws ServiceException {
        //1. 查询调压设备
        CollectDeviceEntity regulator_1 = pcRegulatorDeviceMonitorCollectDataMapper.selectIdAndIsValid(regulatorDeviceId);
        if (regulator_1 == null){
            throw new ServiceException(Device_ErrorsEnum.REGULATORDEVICE_MONITOR_ALARMDATASERVICE_GET_201);
        }
        //2. 查询调压设备的下的监控设备
        Integer regulatorId_1 = regulator_1.getId();
        IotDeviceEntity monitor_1 = pcRegulatorDeviceMonitorCollectDataMapper.selectIotCollectDeviceIdAndValid(regulatorId_1,monitorId);
        if (monitor_1 == null){
            throw new ServiceException(Device_ErrorsEnum.REGULATORDEVICE_MONITOR_ALARMDATASERVICE_GET_202);
        }
        //3. 查询监控设备的采集数据
        String _show = HzhrTypeUtil.object2string(query.get("_show"));
        Boolean _show_total = HzhrTypeUtil.object2boolean(query.get("_show_total"));

        Integer _page = HzhrTypeUtil.object2integer(query.get("_page"));
        Integer _count = HzhrTypeUtil.object2integer(query.get("_count"));
        Integer start = null;
        if (_page != null && _count != null && _page > 0 && _count > 0) {
            start = (_page - 1) * _count;
        }
        Long _greaterthanorequal_collectTime = HzhrTypeUtil.object2long(query.get("_greaterthanorequal_collectTime"));
        Date date1 = null;
        if (_greaterthanorequal_collectTime != null) {
            date1 = new Date(_greaterthanorequal_collectTime);
        }
        String dateStr1 = null;
        if (date1 != null) {
            dateStr1 = HzhrDateUtil.dateToStr(date1);
        }

        Long _lessthan_collectTime = HzhrTypeUtil.object2long(query.get("_lessthan_collectTime"));
        Date date2 = null;
        if (_lessthan_collectTime != null) {
            date2 = new Date(_lessthan_collectTime);
        }
        String dateStr2 = null;
        if (date2 != null) {
            dateStr2 = HzhrDateUtil.dateToStr(date2);
        }

        Integer IotDeviceId = monitor_1.getId();
        List<RegulatorCollectDataEntity> collectDatas_1 = null;
        if (_show != null) {
//            collectDatas_1 = pcRegulatorDeviceMonitorCollectDataMapper.selectRegulatorCollectDataAndIotDeviceid(IotDeviceId);.selectRegulatorCollectDataAndIotDeviceid(IotDeviceId);
            collectDatas_1 = pcRegulatorDeviceMonitorCollectDataMapper.selectRegulatorCollectDataAndIotDeviceidOrderByCollectTime(start,_count,dateStr1,dateStr2,IotDeviceId, "desc");
        }

        int Toatl = 0;
        if (_show_total){
            Toatl = pcRegulatorDeviceMonitorCollectDataMapper.selectCountRegulatorCollectDataAndIotDeviceid(dateStr1,dateStr2,IotDeviceId);
        }

        //3. 返回信息
        RegulatorDevice_Monitor_CollectDataGetModel result = new RegulatorDevice_Monitor_CollectDataGetModel();
        if ("one".equals(_show)) {
            if (collectDatas_1 != null && collectDatas_1.size() > 0) {
                RegulatorCollectDataEntity regulatorCollectDataEntityExt = collectDatas_1.get(0);
                RegulatorDevice_Monitor_CollectDataModel regulatorDevice_monitor_collectDataModel = new RegulatorDevice_Monitor_CollectDataModel();
                regulatorDevice_monitor_collectDataModel.setInPressure(regulatorCollectDataEntityExt.getInPressure());
                regulatorDevice_monitor_collectDataModel.setEnvTemperature(regulatorCollectDataEntityExt.getEnvTemperature());
                regulatorDevice_monitor_collectDataModel.setOutPressure1(regulatorCollectDataEntityExt.getOutPressure1());
                regulatorDevice_monitor_collectDataModel.setOutPressure2(regulatorCollectDataEntityExt.getOutPressure2());
                regulatorDevice_monitor_collectDataModel.setOutPressure3(regulatorCollectDataEntityExt.getOutPressure3());
                regulatorDevice_monitor_collectDataModel.setOutPressure4(regulatorCollectDataEntityExt.getOutPressure4());
                regulatorDevice_monitor_collectDataModel.setOutTemperature1(regulatorCollectDataEntityExt.getOutTemperature1());
                regulatorDevice_monitor_collectDataModel.setOutTemperature2(regulatorCollectDataEntityExt.getOutTemperature2());
                regulatorDevice_monitor_collectDataModel.setOutTemperature3(regulatorCollectDataEntityExt.getOutTemperature3());
                regulatorDevice_monitor_collectDataModel.setOutTemperature4(regulatorCollectDataEntityExt.getOutTemperature4());
                regulatorDevice_monitor_collectDataModel.setOutStaTotalFlow1(regulatorCollectDataEntityExt.getOutStaTotalFlow1());
                regulatorDevice_monitor_collectDataModel.setOutStaTotalFlow2(regulatorCollectDataEntityExt.getOutStaTotalFlow2());
                regulatorDevice_monitor_collectDataModel.setOutStaTotalFlow3(regulatorCollectDataEntityExt.getOutStaTotalFlow3());
                regulatorDevice_monitor_collectDataModel.setOutStaTotalFlow4(regulatorCollectDataEntityExt.getOutStaTotalFlow4());
                regulatorDevice_monitor_collectDataModel.setOutStaFlowRate1(regulatorCollectDataEntityExt.getOutStaFlowRate1());
                regulatorDevice_monitor_collectDataModel.setOutStaFlowRate2(regulatorCollectDataEntityExt.getOutStaFlowRate2());
                regulatorDevice_monitor_collectDataModel.setOutStaFlowRate3(regulatorCollectDataEntityExt.getOutStaFlowRate3());
                regulatorDevice_monitor_collectDataModel.setOutStaFlowRate4(regulatorCollectDataEntityExt.getOutStaFlowRate4());
                regulatorDevice_monitor_collectDataModel.setCollectTime(HzhrTypeUtil.date2long(regulatorCollectDataEntityExt.getCollectTime()));
                regulatorDevice_monitor_collectDataModel.setPressure(regulatorCollectDataEntityExt.getPressure());
                result.setModel(regulatorDevice_monitor_collectDataModel);
            }
        }

        if ("list".equals(_show)) {
            List<RegulatorDevice_Monitor_CollectDataModel> regulatorDevice_monitor_collectDataModels = new ArrayList<>();
            if (collectDatas_1 != null) {
                for (RegulatorCollectDataEntity regulatorCollectDataEntityExts : collectDatas_1){
                    RegulatorDevice_Monitor_CollectDataModel regulatorDevice_monitor_collectDataModel = new RegulatorDevice_Monitor_CollectDataModel();
                    regulatorDevice_monitor_collectDataModel.setInPressure(regulatorCollectDataEntityExts.getInPressure());
                    regulatorDevice_monitor_collectDataModel.setEnvTemperature(regulatorCollectDataEntityExts.getEnvTemperature());
                    regulatorDevice_monitor_collectDataModel.setOutPressure1(regulatorCollectDataEntityExts.getOutPressure1());
                    regulatorDevice_monitor_collectDataModel.setOutPressure2(regulatorCollectDataEntityExts.getOutPressure2());
                    regulatorDevice_monitor_collectDataModel.setOutPressure3(regulatorCollectDataEntityExts.getOutPressure3());
                    regulatorDevice_monitor_collectDataModel.setOutPressure4(regulatorCollectDataEntityExts.getOutPressure4());
                    regulatorDevice_monitor_collectDataModel.setOutTemperature1(regulatorCollectDataEntityExts.getOutTemperature1());
                    regulatorDevice_monitor_collectDataModel.setOutTemperature2(regulatorCollectDataEntityExts.getOutTemperature2());
                    regulatorDevice_monitor_collectDataModel.setOutTemperature3(regulatorCollectDataEntityExts.getOutTemperature3());
                    regulatorDevice_monitor_collectDataModel.setOutTemperature4(regulatorCollectDataEntityExts.getOutTemperature4());
                    regulatorDevice_monitor_collectDataModel.setOutStaTotalFlow1(regulatorCollectDataEntityExts.getOutStaTotalFlow1());
                    regulatorDevice_monitor_collectDataModel.setOutStaTotalFlow2(regulatorCollectDataEntityExts.getOutStaTotalFlow2());
                    regulatorDevice_monitor_collectDataModel.setOutStaTotalFlow3(regulatorCollectDataEntityExts.getOutStaTotalFlow3());
                    regulatorDevice_monitor_collectDataModel.setOutStaTotalFlow4(regulatorCollectDataEntityExts.getOutStaTotalFlow4());
                    regulatorDevice_monitor_collectDataModel.setOutStaFlowRate1(regulatorCollectDataEntityExts.getOutStaFlowRate1());
                    regulatorDevice_monitor_collectDataModel.setOutStaFlowRate2(regulatorCollectDataEntityExts.getOutStaFlowRate2());
                    regulatorDevice_monitor_collectDataModel.setOutStaFlowRate3(regulatorCollectDataEntityExts.getOutStaFlowRate3());
                    regulatorDevice_monitor_collectDataModel.setOutStaFlowRate4(regulatorCollectDataEntityExts.getOutStaFlowRate4());
                    regulatorDevice_monitor_collectDataModel.setCollectTime(HzhrTypeUtil.date2long(regulatorCollectDataEntityExts.getCollectTime()));
                    regulatorDevice_monitor_collectDataModel.setPressure(regulatorCollectDataEntityExts.getPressure());
                    regulatorDevice_monitor_collectDataModels.add(regulatorDevice_monitor_collectDataModel);
                    result.setModelList(regulatorDevice_monitor_collectDataModels);
                }
            }
        }
        result.setTotal(Toatl);
        return result;
    }
}

